package com.lx.controller;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ajax")
public class AjaxController {

    // 测试ajax请求
    @RequestMapping("/test1")
    public String test1(String username, String password, Model model) {
        String msg = "";
        if(username!=null && username.length()>0 && password!=null && password.length()>0){
            if("admin".equals(username) && "123456".equals(password)){
                msg = "ok";
                return msg;
            }else{
                msg = "用户名密码错误";
                return msg;
            }
        }else{
            msg = "用户名密码错误";
            return msg;
        }
    }
}
